using JoyfulHomeJourney.BackEnd.Infrastructure.EFCore;
using JoyfulHomeJourney.BackEnd.Infrastructure.Dtos.Responses.Objects;
using JoyfulHomeJourney.BackEnd.Infrastructure.Tools;
namespace JoyfulHomeJourney.BackEnd.Server.Instances.Extends.Responses
{
    public static class SysCarSuppliesExtend
    {
        public static ResponseSysCarSuppliesDto ToResponseDto(this SysCarSupplies entity, SysProducts product)
        {
            return new ResponseSysCarSuppliesDto
            {
                id = entity.CsId,
                productId = entity.CsProductId,
                category = entity.CsCategory,
                color = entity.CsColor,
                weight = entity.CsWeight,
                dimension = entity.CsDimension,
                markUp = entity.CsMarkUp,
                createMan = entity.CsCreateMan,
                brand = product.PBrand,
                createAt = product.PCreateAt,
                createAtStr = Tools.TimeToString(product.PCreateAt),
                deduction = product.PDeduction,
                description = product.PDescription,
                discount = product.PDiscount,
                images = product.PImages,
                name = product.PName,
                price = product.PPrice,
                rating = product.PRating,
                saleCount = product.PSaleCount,
                saleSum = product.PSaleSum,
                stockQuantity = product.PStockQuantity,
                productCategory=product.PCategory,
                updateAt = product.PUpdateAt,
                updateAtStr = Tools.TimeToString(product.PUpdateAt),
            };
        }
    }
}
